using IQIGame.Onigao.Framework;
using IQIGame.Onigao.Game;

namespace IQIGame.Onigao.GamePlay
{
    public class UD_HeroInfo : UIBaseData
    {
        public HeroData heroData { get; private set; }
        public bool isShowList { get; private set; }
        /// <summary>
        /// 显示的页签index
        /// </summary>
        public int indexTab { get; private set; }

        public UD_HeroInfo() { }

        public UD_HeroInfo Sync(HeroData heroData, bool isShowList, int indexTab = 0)
        {
            this.heroData = heroData;
            this.isShowList = isShowList;
            this.indexTab = indexTab;
            return this;
        }

        public void UpdateHeroData(HeroData heroData)
        {
            this.heroData = heroData;
        }

        public void UpdateIndexTab(int indexTab)
        {
            this.indexTab = indexTab;
        }

        public void Clear()
        {
            this.heroData = null;
            this.isShowList = false;
            this.indexTab = 0;
        }

        #region 对象池

        public override void OnReset()
        {
            this.Clear();
        }

        static public UD_HeroInfo NewFromPool()
        {
            return ClassPool.Get<UD_HeroInfo>();
        }
        #endregion
    }
}
